import time
import unittest
import sqlparse.exceptions
from selenium.webdriver.common.by import By
from selenium import webdriver
from selenium.webdriver import Keys
from data import db
from ddt import ddt,file_data
@ddt
class A3mall(unittest.TestCase):

    def setUp(self) -> None:
        self.driver=webdriver.Firefox()
        self.driver.get('https://mail.126.com/')
        self.driver.maximize_window()
        time.sleep(7)

    def tearDown(self) -> None:
        time.sleep(3)
        self.driver.quit()

    @file_data(r'D:\gao1\PythonProject4\jsona.json')
    def test_a3mall_01(self,username,password):
        time.sleep(2)
        #输入账号和密码
        self.driver.switch_to.frame(self.driver.find_element(By.XPATH,'//iframe[starts-with(@id,"x-URS-iframe")]'))
        self.driver.find_element(By.XPATH,'//input[contains(@id,"auto-id")]').send_keys(username)
        self.driver.find_element(By.XPATH,'//input[contains(@id,"auto-id")]').send_keys(password)
        time.sleep(5)


